﻿using System.ComponentModel.DataAnnotations;

namespace Shop.Model.Dto.Admin.Goods;

/// <summary>
/// 修改商品
/// </summary>
public class GodEditDto
{
    /// <summary>
    /// 商品Id
    /// </summary>
    [Required(ErrorMessage = "商品Id不可为空")]
    public long Id { get; set; }
    
    /// <summary>
    /// 商品名
    /// </summary>
    [Required(ErrorMessage = "商品名不可为空")]
    public string Name { get; set; }
    
    /// <summary>
    /// 封面图
    /// </summary>
    [Required(ErrorMessage = "封面图不可为空")]
    public string Cover { get; set; }
    
    /// <summary>
    /// 轮播图
    /// </summary>
    [Required(ErrorMessage = "轮播图不可为空")]
    public string Banner { get; set; }
    
    /// <summary>
    /// 详情图
    /// </summary>
    [Required(ErrorMessage = "详情图不可为空")]
    public string Details { get; set; }
    
    /// <summary>
    /// 划线价
    /// </summary>
    [Required(ErrorMessage = "划线价不可为空")]
    public decimal LineationPrice { get; set; }
    
    /// <summary>
    /// 是否上架
    /// </summary>
    [Required(ErrorMessage = "上架状态不可为空")]
    public bool Saleable { get; set; }
    
    /// <summary>
    /// 规格数据(json对象)
    /// </summary>
    [Required(ErrorMessage = "用户Id不可为空")]
    public string Spc { get; set; }
    
    /// <summary>
    /// 上架时间
    /// </summary>
    public DateTime? UpTime { get; set; }
    
    /// <summary>
    /// 下架时间
    /// </summary>
    public DateTime? DownTime { get; set; }
    
    /// <summary>
    /// 商品类型
    /// 1：单品
    /// 2：礼包
    /// </summary>
    [Required(ErrorMessage = "商品类型不可为空")]
    public int Type { get; set; }
    
    /// <summary>
    /// 可购买商品用户等级
    /// </summary>
    public int? UserGrade { get; set; }
    
    /// <summary>
    /// 商品规格信息
    /// </summary>
    public List<GodSizeList> GodSizeList { get; set; }
}

/// <summary>
/// 商品规格
/// </summary>
public class GodSizeList
{
    /// <summary>
    /// 规格编码
    /// </summary>
    [Required(ErrorMessage = "规格编码不可为空")]
    public string Code { get; set; }
    
    /// <summary>
    /// 缩略图
    /// </summary>
    [Required(ErrorMessage = "缩略图不可为空")]
    public string Thumbnail { get; set; }
    
    /// <summary>
    /// 库存
    /// </summary>
    [Required(ErrorMessage = "库存不可为空")]
    public int Stock { get; set; }
    
    /// <summary>
    /// 是否有效
    /// </summary>
    [Required(ErrorMessage = "是否有效不可为空")]
    public bool Valid { get; set; }
    
    /// <summary>
    /// 名称（规格key和value组成）
    /// </summary>
    [Required(ErrorMessage = "名称不可为空")]
    public string Name { get; set; }
    
    /// <summary>
    /// 映射数量
    /// </summary>
    [Required(ErrorMessage = "映射数量不可为空")]
    public int Count { get; set; }
    
    /// <summary>
    /// 是否默认规格
    /// </summary>
    [Required(ErrorMessage = "默认状态不可为空")]
    public bool IsDefault { get; set; }
    
    /// <summary>
    /// 单量积分
    /// </summary>
    [Required(ErrorMessage = "单量积分不可为空")]
    public int Point { get; set; }
    
    /// <summary>
    /// 零售价
    /// </summary>
    [Required(ErrorMessage = "零售价不可为空")]
    public decimal Price { get; set; }
    
    /// <summary>
    /// V1购买价
    /// </summary>
    [Required(ErrorMessage = "V1购买价不可为空")]
    public decimal OnePrice { get; set; }
    
    /// <summary>
    /// V2购买价
    /// </summary>
    [Required(ErrorMessage = "V2购买价不可为空")]
    public decimal TwoPrice { get; set; }
    
    /// <summary>
    /// V3购买价
    /// </summary>
    [Required(ErrorMessage = "V3购买价不可为空")]
    public decimal ThreePrice { get; set; }
}